/**
 * @Title: index.js
 * @Description: index 课程质量
 * @author: Fanchao
 * @date: 2020/8/2 5:36 下午
 * @version V1.0
 */
import React, { useState } from 'react';
import { Radio } from 'antd';
import styles from './index.less';
import EvaluateObject from '@/pages/teaching-quality/class-evaluations/components/evaluate-object';
import HistoryData from '@/pages/teaching-quality/class-evaluations/components/history-data';
import { connect } from 'umi';
import HistoryFile from '@/pages/teaching-quality/class-evaluations/components/history-file';

const TeachersEvaluations = ({ dispatch }) => {
    const [tabVal, setTabVal] = useState('1');
    const tabSelect = (v) => {
        const tabVal = v.target.value;
        setTabVal(tabVal);
    };
    return (
        <div className={styles.pageContainer}>
            <div style={{ marginBottom: '10px' }}>
                <Radio.Group size="large" value={tabVal} onChange={tabSelect}>
                    {/*<Radio.Button value="0">评估对象</Radio.Button>*/}
                    <Radio.Button value="1">历史导入评估数据</Radio.Button>
                </Radio.Group>
            </div>
            {
                tabVal === '1' ? <HistoryFile dispatch={dispatch}/> : null
            }
            <div className={styles.pageContainerTable}>
                {
                    tabVal === '0' ? <EvaluateObject/> : <HistoryData/>
                }
            </div>
        </div>
    );
};

export default connect(({ classEvaluations, dispatch, loading }) => ({
    classEvaluations,
    dispatch,
    loading: loading.effects['classEvaluations/getDataSource'],
}))(TeachersEvaluations);
